home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / share / 17 / dings_e.exe / Compiler / Include / PROFIL.H < prev    next >
C/C++ Source or Header  |  1999-11-07  |  1KB  |  50 lines

  1. /* profil.h: gprof profiling header file
  2.  
  3.    Copyright 1998 Cygnus Solutions.
  4.  
  5. This file is part of Cygwin.
  6.  
  7. This software is a copyrighted work licensed under the terms of the
  8. Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
  9. details. */
  10.  
  11. /*
  12.  * This file is taken from Cygwin distribution. Please keep it in sync.
  13.  * The differences should be within __MINGW32__ guard.
  14.  */
  15.  
  16. /* profiling frequency.  (No larger than 1000) */
  17. #define PROF_HZ            100
  18.  
  19. /* convert an addr to an index */
  20. #define PROFIDX(pc, base, scale)    \
  21.   ({                                    \
  22.     size_t i = (pc - base) / 2;                \
  23.     if (sizeof (unsigned long long int) > sizeof (size_t))        \
  24.       i = (unsigned long long int) i * scale / 65536;            \
  25.     else                                \
  26.       i = i / 65536 * scale + i % 65536 * scale / 65536;        \
  27.     i;                                    \
  28.   })
  29.  
  30. /* convert an index into an address */
  31. #define PROFADDR(idx, base, scale)    \
  32.     ((base) + ((((idx) << 16) / (scale)) << 1))
  33.  
  34. /* convert a bin size into a scale */
  35. #define PROFSCALE(range, bins)        (((bins) << 16) / ((range) >> 1))
  36.  
  37. typedef void *_WINHANDLE;
  38.  
  39. struct profinfo {
  40.     _WINHANDLE targthr;            /* thread to profile */
  41.     _WINHANDLE profthr;            /* profiling thread */
  42.     u_short *counter;            /* profiling counters */
  43.     u_long lowpc, highpc;        /* range to be profiled */
  44.     u_int scale;            /* scale value of bins */
  45. };
  46.  
  47. int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int);
  48. int profil(char *, size_t, u_long, u_int);
  49.  
  50.